From: Sam Steingold Date: Sun, 11 Mar 2007 21:08:45 +0000 (+0000) Subject: tweak last patch: add comment and avoid the first sleep X-Git-Tag: archive/raspbian/1%29.2+1-2+rpi1~1^2~1614 X-Git-Url: https://dgit.raspbian.org/%22http:/www.example.com/cgi/%22https:/www.github.com/%22bookmarks:///%22http:/www.example.com/cgi/%22https:/www.github.com/%22bookmarks:/?a=commitdiff_plain;h=07244fb9f44ab316f6952d5d2b797664091c949c;p=emacs.git tweak last patch: add comment and avoid the first sleep --- diff --git a/src/process.c b/src/process.c index 0fbbd5d34c3..975d92f36f1 100644 --- a/src/process.c +++ b/src/process.c @@ -6495,13 +6495,16 @@ sigchld_handler (signo) #define WUNTRACED 0 #endif /* no WUNTRACED */ /* Keep trying to get a status until we get a definitive result. */ - do - { - sleep (1); - errno = 0; - pid = wait3 (&w, WNOHANG | WUNTRACED, 0); - } - while (pid < 0 && errno == EINTR); + while (1) { + errno = 0; + pid = wait3 (&w, WNOHANG | WUNTRACED, 0); + if (! (pid < 0 && errno == EINTR)) + break; + /* avoid a busyloop: wait3 is a system call, so we do not want + to prevent the kernel from actually sending SIGCHLD to emacs + by asking for it all the time */ + sleep (1); + } if (pid <= 0) {